<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script type="text/javascript">
			class User {
				// 构造函数
				constructor(name, age = 20) {
					this.name = name;
					this.age = age;
				}
				// 定义方法
				sayHello() {
					return "Hello: " + this.name;
				}
				// 静态方法
				static isAdult(age) {
					if(age >= 18) {
						return " 成年 " + age;
					}
					return " 未成年 " + age;

				}
			}
			let user = new User("Tom", 23);
			console.log(user);
			console.log(user.sayHello());
</head>
</body>

</html>